package com.slz3.business.module.configManagement.conZone.domain;

import com.slz3.business.frame.enums.AuditFlag;
import com.slz3.business.frame.enums.UsingFlag;
import com.slz3.business.frame.util.UUIDUtils;
import com.slz3.business.frame.util.VE;

import java.time.LocalDateTime;

public class ConZoneFactory {

    /**
     * 初始化基础属性值
     */
    public static ConZone initBaseFields(ConZone conZone) {
        if (conZone.getUuid() == null) {
            conZone.setUuid(UUIDUtils.generateUUID());
            conZone.setCreateTime(LocalDateTime.now());
            if (VE.isEmpty(conZone.getSerAudit())) {
                conZone.setSerAudit(AuditFlag.WAIT_SUBMIT);
            }
            if (VE.isEmpty(conZone.getSerUsing())) {
                conZone.setSerUsing(UsingFlag.ENABLE);
            }
        } else {
            conZone.setLastModifyTime(LocalDateTime.now());
        }
        return conZone;
    }

    /**
     * 初始化基础属性值
     */
    public static ConZone initBaseFields() {
        return initBaseFields(newTemStyle());
    }

    public static ConZone newTemStyle() {
        return new ConZone();
    }

}
